import { ListPage } from "custom/index";
import { getSalesPagePage } from './api'
import SaleSearch from './component/SaleSearch.vue'

import CheckPageTableBefore from './custom/CheckPageTableBefore'
import TableBefore from './component/SaleSearchTableBefore.vue'
const tableBefore = new CheckPageTableBefore('DataQueryHistoryTableBefore')
tableBefore.setComponent(TableBefore)
import dayjs from 'dayjs'

const page = new ListPage('DayPage');

page
  .api(getSalesPagePage)
  .useSearch()
    .addInputItem('monthStart', '', dayjs().subtract(6, 'month').format('YYYY-MM'))
    .addItem({ prop: 'monthEnd', default: dayjs().format('YYYY-MM') })
    .setComponent(SaleSearch)
    .end()
  .useTable()
    .useIndexColumn().end()
    .useColumn('month').label('服务日期').minWidth(140).end()
    .useColumn('sumSalesRevenue').label('总销售额（元）').minWidth(140).end()
    .end()
  .usePagination()
    .end()
  .addChild(tableBefore, 'table-before')

export default page
